template <typename T>
struct myvec{
           myvec(int i){
               data_ = new T[i];
               idx = 0;
               size = i;
           }
           myvec(int i, int ele){
               data_ = new T[i];
               idx = 0;
               size = i;
               for(int i = 0; i<size;i++){
                    data_[idx++] = ele;
               }
           }
           myvec(std::initializer_list<int> ele){
               size = ele.size();
               idx = size - 1;
           }
           void push_back(T t){
               if (idx < size ) {
                   data_[idx++] = t;
               }
               else{  // mem reallocator
                   std::cout<<"resiz vec" <<"\n";
                   swap_ = new T(size*2);
                   size = 2*size;
                   for(int i =0 ;i<size/2 - 1; i++){
                       swap_[i] = data_[i];
                   }
                   delete[]data_;
                   data_ =swap_;
                   push_back(t);  // push 当次应push的元素
               }
           }
           void show(){
               std::cout<<"curr size" <<size<<"\n";
               for(int i =0 ;i < size; i++){
                   std::cout<<data_[i]<<"\n";
               }
           }
           T operator [](int i){
               return data_[i];
           }
           int size;
           int idx;
           T *data_;
           T *swap_;
       };